home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************************/
- /* FinderFilesProc */
- /* */
- /* If the program was entered by the user's selecting one or more files, and then */
- /* using "Open" from the Finder menu (or command-O, or by dragging the file icons */
- /* into the application program icon (System 7)), open each of the files. */
- /* */
- /* If the program was entered by the user's selecting one or more files, and then */
- /* using "Print" from the Finder menu (or command-P), then for each file, open it, */
- /* print it, and close it. After this has been done for each file, quit. */
- /************************************************************************************/
-
- #include "MyHeaders.h"
-
- short FinderFilesProc ()
- {
- short FFRetCode = 0;
-
- UseResFile (initResRefNum); /* for H/P printer */
-
- appIndex = 1; /* initialize */
- CountAppFiles (&appMessage, &appCount); /* How many from Finder? */
- if (appCount > 0) /* if 1 or more */
- {
- if (appMessage == appOpen) /* if they are for "Open" */
- {
- for (appIndex=1; appIndex <= appCount; appIndex++) /* for each one */
- {
- appMenuLong = ((0x010000 * FileMenuID) + OpenItem); /* menu parm */
- WorkRetCode = MenuProc (appMenuLong); /* do "open" menu item */
- if (WorkRetCode != 0)
- break;
- ClrAppFiles (appIndex); /* remove from Finder list */
- }
- }
- else
- if (appMessage == appPrint) /* if they are for "Print" */
- {
- for (appIndex=1; appIndex <= appCount; appIndex++) /* for each one */
- {
- appMenuLong = ((0x010000 * FileMenuID) + OpenItem); /* menu parm */
- WorkRetCode = MenuProc (appMenuLong); /* do "open" menu item */
- if (WorkRetCode != 0)
- break;
-
- appMenuLong = ((0x010000 * FileMenuID) + PrintItem); /* menu parm */
- WorkRetCode = MenuProc (appMenuLong); /* do "print" menu item */
- if (WorkRetCode != 0)
- break;
-
- appMenuLong = ((0x010000 * FileMenuID) + CloseItem); /* menu parm */
- WorkRetCode = MenuProc (appMenuLong); /* do "close" menu item */
-
- ClrAppFiles (appIndex); /* remove from Finder list */
- }
-
- appMenuLong = ((0x010000 * FileMenuID) + QuitItem); /* menu parm */
- WorkRetCode = MenuProc (appMenuLong); /* do "quit" menu item */
- }
- }
-
- return FFRetCode;
- }